package com.myfum.wingplayer.entity
{
	import flash.events.Event;

	[Bindable]
	public class ScheduleItemData extends Serializer
	{
		public function ScheduleItemData()
		{
		}
		
		/*private var _startTime:Date;
		private var _endTime:Date;*/
		
		public var startTime:Date = new Date();
		public var endTime:Date = new Date();
		public var programPath:String;
		//public var programData:ProgramData;
		
		/*[Bindable("change")]
		public function get endTime():Date
		{
			return _endTime;
		}

		public function set endTime(value:Date):void
		{
			_endTime = value;
			dispatchEvent(new Event("change"));
		}

		[Bindable("change")]
		public function get startTime():Date
		{
			return _startTime;
		}

		public function set startTime(value:Date):void
		{
			_startTime = value;
			dispatchEvent(new Event("change"));
		}*/

		[Bindable("change")]
		public function get startMinutes():Number{
			if(startTime == null){
				startTime = new Date();
			}
			return startTime.hours*60 + startTime.minutes;
		}
		
		public function set startMinutes(value:Number):void{
			if(startTime == null){
				startTime = new Date();
			}
			startTime.hours   = Math.floor(value/60);
			startTime.minutes = value%60;
			dispatchEvent(new Event("change"));
		}
		
		[Bindable("change")]
		public function get endMinutes():Number{
			if(endTime == null){
				endTime = new Date();
			}
			return endTime.hours*60 + endTime.minutes;
		}
		
		public function set endMinutes(value:Number):void{
			if(endTime == null){
				endTime = new Date();
			}
			endTime.hours   = Math.floor(value/60);
			endTime.minutes = value%60;
			dispatchEvent(new Event("change"));
		}
	}
}